package org.hive.sequence.plugin
{
	import caurina.transitions.Tweener;
	
	import flash.display.DisplayObject;
	
	import org.hive.Hive;
	import org.hive.managers.plugin.LayoutManager;
	import org.hive.sequence.Sequence;
	
	public class TweenerAction
	{		
		public static function init(hive:Hive):void
		{	
			if(Hive.DEBUG_MODE){trace( "TweenerAction :: init" )}
			
			//_____________ Register Object :: DisplayObject : Tweener
			function tweenableDisplayObjectFunc( action:*, sequence:Sequence, positionInSequence:int ):void {
				var scope:DisplayObject = action.scope as DisplayObject;
				delete action.scope;
				
				var lm:LayoutManager = hive.getManager(LayoutManager.key) as LayoutManager;
				if( !lm.contains( scope ) ) lm.addChild( scope );
				Tweener.addTween( scope, action );
			}
			hive.sequenceManager.registerAction(DisplayObject, tweenableDisplayObjectFunc, true);
		}

	}
}